<template>
  <div class="count">
    <h2>Count组件:{{ count }}</h2>
    <p>总价格是:{{ totalPrice }}</p>
    <button @click="increment1">累加count</button>
    <button @click="incrementN456({ n: 3 })">累加Ncount</button>
    <button @click="incrementWait">等两秒再加</button>
  </div>
</template>

<script>
import { mapState, mapGetters, mapMutations } from "vuex";
export default {
  name: "Count",
  data() {
    return {};
  },
  mounted() {},
  computed: {
    ...mapState(["count", "num"]),

    ...mapGetters(["totalPrice"]),
  },
  methods: {
    ...mapMutations({
      increment1: "increment",
      incrementN456: "incrementN",
      incrementWait: "incrementWait",
    }),
  },
};
</script>

<style scoped>
.count {
  background: pink;
}
</style>